package View;

import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.Font;
import java.io.Serializable;

/** this class provide the GUI window in order to produce comment report for specific sale **/
public class CommentsReportView extends JFrame implements Serializable{
	
	private static final long serialVersionUID = 42L; 
	/** required fields and buttons **/
	 static JTextField SaleIdField;
	JButton ProduceBtn;
	JButton BackBtn;
	JLabel InsertSaleID;
	
	
	
	/** default and only constructor **/
	public CommentsReportView() {
		setResizable(false);
		getContentPane().setLayout(null);
		this.setSize(404, 346);
		this.setLocationRelativeTo(null); 
		this.setTitle("Produce Comments Report To Sale");
		
		InsertSaleID= new JLabel("Insert SaleID");
		InsertSaleID.setFont(new Font("Tahoma", Font.BOLD, 16));
		InsertSaleID.setBounds(137, 31, 183, 28);
		getContentPane().add(InsertSaleID);
		
		ProduceBtn = new JButton("Produce Report");
		ProduceBtn.setFont(new Font("Tahoma", Font.BOLD, 17));
		ProduceBtn.setBounds(105, 140, 183, 85);
		getContentPane().add(ProduceBtn);
		
		SaleIdField = new JTextField();
		SaleIdField.setBounds(105, 82, 183, 44);
		getContentPane().add(SaleIdField);
		SaleIdField.setColumns(10);
		
		BackBtn= new JButton("Back");
		BackBtn.setFont(new Font("Tahoma", Font.BOLD, 16));
		BackBtn.setBounds(137, 251, 106, 45);
		getContentPane().add(BackBtn);
	}
	

	/**
	 * @return button ProduceBtn
	 */
    public JButton getProduceBtn()
    {
  	  return this.ProduceBtn;
    }
    
	/**
	 * @return button BackBtn
	 */
    public JButton getBackBtn()
    {
  	  return this.BackBtn;
    }
    /**
     * add listeners to produce and back buttons function
     * @param actionListener
     */
	public void addCommentReportListeners(ActionListener actionListener){
		ProduceBtn.addActionListener(actionListener);
		BackBtn.addActionListener(actionListener);
	}
	

	/**
	 * @return saleid text field function
	 */
	public  static String getSaleRepId()
	{
		return SaleIdField.getText().toString();
	}
	
	/** clear the field function in order to produce new report **/
	public void clearFields()
	{
		InsertSaleID.setText("");
	}
	
	/** show and hide window functions **/
	public void showWindow(){
		setVisible(true);
	}
	public void hideWindow(){
		setVisible(false);
	}
	
}